//
//  main.m
//  daima
//
//  Created by mac on 16-4-12.
//  Copyright (c) 2016年 mjh. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Atom.h"
#import "Animal.h"
#import "Person.h"
#import "Mouse.h"
int main(int argc, const char * argv[])
{

    @autoreleasepool {
        
        // insert code here...
        NSLog(@"Hello, World!");
        Atom * atom = [[Atom alloc] init];
        NSLog(@"Atom chemical element name:%@",atom.chemicalElement);//初始化的值为None  方法写在Atom中
        
        Person  *p = [[Person alloc]init];
        p.name =@"张三";
        
        Mouse * mouse =[[Mouse alloc]init];
        mouse.name = @"老鼠";
        
        NSArray * arr = @[p,mouse];
        for (int i=0; i<arr.count; i++)
        {
            Animal *ani =arr[i];
            [ani eat];
            [ani sleep];
        }
        
        NSString *str = @"jbj,sjxu,suxu,马家豪";
        NSArray * hgd= [str componentsSeparatedByString:@","];
        for(int i=0;i<hgd.count;i++){
            NSString *s=hgd[i];
            NSLog(@"%d %@",i,s);
            
        }
        
        NSString *stg = @"v,s,w,b,f,g";
        NSArray * anb = [stg componentsSeparatedByString:@","];
        anb=[anb sortedArrayUsingSelector:@selector(compare:)];
        for(int i=0;i<anb.count;i++){
            NSString *s=anb[i];
            NSLog(@"%d %@",i,s);
        }
        
        NSArray *numbers =@[@(9),@(3),@(4),@(2)];
        numbers =[numbers sortedArrayUsingSelector:@selector(compare:)];
        for(int i=0;i<numbers.count;i++){
            NSNumber *s=numbers[i];
            NSLog(@"%d %@",i,s);
        }


    }
    return 0;
}

